package de.fmannan.wildit.ui;

import java.util.Calendar;

import android.app.Activity;
import android.app.Dialog;
import android.app.TimePickerDialog;
import android.os.Bundle;
import android.widget.TimePicker;
import android.widget.Toast;

public abstract class TimePickerActivity extends Activity {

	static final int TIME_DIALOG_ID = 0;
	
	protected abstract TimePickerDialog.OnTimeSetListener getListener();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		showDialog(TIME_DIALOG_ID);
	}

	@Override
	protected Dialog onCreateDialog(int id) {
		switch (id) {
		case TIME_DIALOG_ID:
			//Display time picker dialog with current time as the default
			return new TimePickerDialog(this, getListener(), Calendar
					.getInstance().get(Calendar.HOUR_OF_DAY), Calendar
					.getInstance().get(Calendar.MINUTE), true);
		}
		return null;
	}
}
